<?php
	//$userid = $_userid;
	
	
	switch($action){
		
		case 'manage':
			$_userid = $_userid == 1 && $userid  ? $userid : $_userid; // 管理员编辑其他会员信息权限
			if(!$_userid) showmessage('您还没有登陆，即将跳转到登陆页面',url("?module=member&action=login&forward=".urlencode(URL)));
			// common
			if(!isset($action)) $action = 'manage';
			include 'includes/collect.class.php';
			$c = new collect();
			$c->set_userid($userid);
			// common
			
			if(isset($job))
			{
				$where = "WHERE userid='$_userid'";
			}
			else
			{
				$where = "WHERE vid='$_userid'";
			}
			$infos = $c->listinfo($where, '`cid` DESC', $page, 30, 1);
			$pages = $c->pages;
			include template('collect_manage.html','yellowpage');
		break;
	
		case 'delete':
			
			$_userid = $_userid == 1 && $userid  ? $userid : $_userid; // 管理员编辑其他会员信息权限
			if(!$_userid) showmessage('您还没有登陆，即将跳转到登陆页面',url("?module=member&action=login&forward=".urlencode(URL)));
			// common
			if(!isset($action)) $action = 'manage';
			include 'includes/collect.class.php';
			$c = new collect();
			$c->set_userid($userid);
			// common
			
			$c->delete($cid);
			showmessage('操作成功',$forward);
			include template('collect_manage.html','yellowpage');
			break;
			
		default:
			 //$referer = urlencode($_GET['referer']);
			if(!$_userid) exit("alert('你还没有登陆，请先登录')");
			include 'includes/collect.class.php';
			$c = new collect();
			if(strpos($referer,'.html')===false) $referer = $referer.'&id='.$id;
			$c->add($userid,$title,$referer);
			/*if($returnid)
			{
				echo "document.getElementById(\"$returnid\").innerHTML = \"<font color='red'>添加成功</font>\"";
			}
			else
			{
				echo "alert('添加成功');";
			}*/
			showmessage('添加成功',$forward);
			  

		break;
	}
?>